#include <iostream> 
#include <algorithm>
#include <vector>

using namespace std;

class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        vector<int> ranVt(26, 0);
        vector<int> magVt(26, 0);
        for (auto ch : ransomNote) {
            ranVt[ch - 'a']++;
        }
        for (auto ch : magazine) {
            magVt[ch - 'a']++;
        }

        for (int idx = 0; idx < ransomNote.size(); idx++) {
            if (ranVt[ransomNote[idx] - 'a'] > magVt[ransomNote[idx] - 'a']) {
                return false;
            }
        }
        return true;
    }
};

int main()
{
    Solution s;
    string str1{"bg"};
    string str2{"efjbdfbdgfjhhaiigfhbaejahgfbbgbjagbddfgdiaigdadhcfcj"};
    cout << boolalpha << s.canConstruct(str1, str2) << endl;
    return 0;
}